<?php

namespace app\index\validate\trade;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class LawCase
 * @package app\index\validate\trade
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 */
class LawCase extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'isId',
        'questionId' => 'integer|max:11',
        'memberId' => 'integer|max:11',
        'creatorId' => 'integer|max:11',
        'creatorMemberType' => 'integer|egt:0|max:3',
        'ask' => 'scalar|max:2000',
        'categoryId' => 'integer|max:5',
        'provinceId' => 'integer|max:8',
        'cityId' => 'integer|max:8',
        'phone' => 'scalar|max:11',
        'alwaysLive' => 'integer|max:3',
        'isSelf' => 'integer|max:3',
        'employLawyer' => 'integer|max:3',
        'isPublish' => 'integer|egt:0|max:1',
        'publishTime' => 'likeId',
        'status' => 'integer|egt:0|max:1',
        'buyType' => 'integer|egt:0|max:1',
        'price' => 'numeric',
        'num' => 'integer|egt:0|max:1',
        'surplus' => 'integer|egt:0|max:1',
        'updated' => 'integer|egt:0|max:11',
        'created' => 'integer|egt:0|max:11',
        'page' => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id' => 'id',
        'questionId' => 'questionId',
        'memberId' => 'memberId',
        'creatorId' => 'creatorId',
        'creatorMemberType' => 'creatorMemberType',
        'ask' => 'ask',
        'categoryId' => 'categoryId',
        'provinceId' => 'provinceId',
        'cityId' => 'cityId',
        'phone' => 'phone',
        'alwaysLive' => 'alwaysLive',
        'isSelf' => 'isSelf',
        'employLawyer' => 'employLawyer',
        'isPublish' => 'isPublish',
        'publishTime' => 'publishTime',
        'status' => 'status',
        'buyType' => 'buyType',
        'price' => 'price',
        'num' => 'num',
        'surplus' => 'surplus',
        'updated' => 'updated',
        'created' => 'created',
        'page' => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => '缺少:attribute',
        'id.isId' => '请设置正确的:attribute',
        'questionId.require' => '请输入:attribute',
        'questionId.integer' => ':attribute应该是整数',
        'questionId.max' => ':attribute长度不能超过:rule位',
        'memberId.require' => '请输入:attribute',
        'memberId.integer' => ':attribute应该是整数',
        'memberId.max' => ':attribute长度不能超过:rule位',
        'creatorId.require' => '请输入:attribute',
        'creatorId.integer' => ':attribute应该是整数',
        'creatorId.max' => ':attribute长度不能超过:rule位',
        'creatorMemberType.require' => '请输入:attribute',
        'creatorMemberType.integer' => ':attribute应该是整数',
        'creatorMemberType.egt' => ':attribute应该大于等于:rule',
        'creatorMemberType.max' => ':attribute长度不能超过:rule位',
        'ask.require' => '请输入:attribute',
        'ask.scalar' => ':attribute应该是字符串',
        'ask.max' => ':attribute长度不能超过:rule位',
        'categoryId.require' => '请输入:attribute',
        'categoryId.integer' => ':attribute应该是整数',
        'categoryId.max' => ':attribute长度不能超过:rule位',
        'provinceId.require' => '请输入:attribute',
        'provinceId.integer' => ':attribute应该是整数',
        'provinceId.max' => ':attribute长度不能超过:rule位',
        'cityId.require' => '请输入:attribute',
        'cityId.integer' => ':attribute应该是整数',
        'cityId.max' => ':attribute长度不能超过:rule位',
        'phone.require' => '请输入:attribute',
        'phone.scalar' => ':attribute应该是字符串',
        'phone.max' => ':attribute长度不能超过:rule位',
        'alwaysLive.require' => '请输入:attribute',
        'alwaysLive.integer' => ':attribute应该是整数',
        'alwaysLive.max' => ':attribute长度不能超过:rule位',
        'isSelf.require' => '请输入:attribute',
        'isSelf.integer' => ':attribute应该是整数',
        'isSelf.max' => ':attribute长度不能超过:rule位',
        'employLawyer.require' => '请输入:attribute',
        'employLawyer.integer' => ':attribute应该是整数',
        'employLawyer.max' => ':attribute长度不能超过:rule位',
        'isPublish.require' => '请输入:attribute',
        'isPublish.integer' => ':attribute应该是整数',
        'isPublish.egt' => ':attribute应该大于等于:rule',
        'isPublish.max' => ':attribute长度不能超过:rule位',
        'publishTime.require' => '请选择:attribute',
        'publishTime.isId' => '请选择正确的:attribute',
        'status.require' => '请输入:attribute',
        'status.integer' => ':attribute应该是整数',
        'status.egt' => ':attribute应该大于等于:rule',
        'status.max' => ':attribute长度不能超过:rule位',
        'buyType.require' => '请输入:attribute',
        'buyType.integer' => ':attribute应该是整数',
        'buyType.egt' => ':attribute应该大于等于:rule',
        'buyType.max' => ':attribute长度不能超过:rule位',
        'price.require' => '请输入:attribute',
        'price.numeric' => ':attribute应该是数字',
        'num.require' => '请输入:attribute',
        'num.integer' => ':attribute应该是整数',
        'num.egt' => ':attribute应该大于等于:rule',
        'num.max' => ':attribute长度不能超过:rule位',
        'surplus.require' => '请输入:attribute',
        'surplus.integer' => ':attribute应该是整数',
        'surplus.egt' => ':attribute应该大于等于:rule',
        'surplus.max' => ':attribute长度不能超过:rule位',
        'updated.require' => '请输入:attribute',
        'updated.integer' => ':attribute应该是整数',
        'updated.egt' => ':attribute应该大于等于:rule',
        'updated.max' => ':attribute长度不能超过:rule位',
        'created.require' => '请输入:attribute',
        'created.integer' => ':attribute应该是整数',
        'created.egt' => ':attribute应该大于等于:rule',
        'created.max' => ':attribute长度不能超过:rule位',
        'page.require' => '请输入:attribute',
        'page.integer' => ':attribute应该是整数',
        'page.egt' => ':attribute应该大于等于:rule',
        'page.max' => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt' => ':attribute应该大于等于:rule',
        'page_size.max' => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index' => ['page', 'page_size'],
        'read' => ['id' => 'require'],
        'save' => ['questionId', 'memberId', 'creatorId', 'creatorMemberType', 'ask', 'categoryId', 'provinceId', 'cityId', 'phone', 'alwaysLive', 'isSelf', 'employLawyer', 'isPublish', 'publishTime', 'status', 'buyType', 'price', 'num', 'surplus', 'updated', 'created'],
    ];

}
